﻿using System;
using System.Linq.Expressions;
using System.Runtime.Serialization;

namespace Emico.Linq.Criterion
{
    [Serializable]
    public class EmptyExpression<T> : AbstractExpression<T>
         where T : class
    {

        #region Constructors

        public EmptyExpression()
        {
        }

        protected EmptyExpression(SerializationInfo info, StreamingContext context)
        {
        }


        #endregion

        #region Implement Abstract Method
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
        }

        public override Expression ToLinqExpression(Criteria<T> criteria, ParameterExpression parameter)
        {
            Expression left = Expression.Constant(true, typeof(bool));
            Expression right = Expression.Constant(true, typeof(bool));
            Expression filter = Expression.Equal(left, right);

            return filter;
        }

        #endregion
    }
}
